import request from '@/utils/request'
const api_name_train = '/train'
const api_name_user = '/user'
export default {
  // 根据课程id 查询出课程的信息
  findTrainById(trainId) {
    return request({
      url: `${api_name_train}/findTrainById/${trainId}`,
      method: 'get'
    })
  },
  // 通过用户id 获取其信息
  findUserMsg(userId) {
    return request({
      url: `${api_name_user}/findUserMsg/${userId}`,
      method: 'get'
    })
  },
  //通过用户id 获取他的参加培训的信息
  findUserAllTrain(trainSearch) {
    return request({
      url: `${api_name_user}/findUserAllTrain`,
      method: 'Post',
      data: trainSearch
    })
  },
  //获得培训的所有状态
  findAllTrainIsSuccess() {
    return request({
      url: `${api_name_train}/findAllTrainIsSuccess`,
      method: 'get'
    })
  },
  // 更新用户信息
  updateUser(userObj) {
    return request({
      url: `${api_name_user}/updateUser`,
      method: 'put',
      data: userObj
    })
  },
  //报名 加入课程
  addTrain(userId, trainId) {
    return request({
      url: `${api_name_train}/addTrain/${userId}/${trainId}`,
      method: 'post',
    })
  }

}

